[iPhone app] Inserting special char un NSString for URL use

Posted by Dough on Stack Overflow See other posts from Stack Overflow or by Dough
Published on 2010-06-16T08:47:23Z Indexed on 2010/06/16 8:52 UTC
Read the original article Hit count: 231

Hi,

I'm using HTTP connection to share data with my JSON server.

I use URLs like "MyServlet?param1=value1" and so on...

I'm now facing a problem with one of my servlet (I can't change it because some other views are using it) :

The servlet is working with a syntax including those symbols "{" and "}".

The exact syntax is

{(value1_value2)(value3_value4)(value5_value6)}{(value7_value8)(value9_value10)(value11_value12)}{(value13_value14)(value15_value16)(value17_value18)}

Values are integers, the problem is only when I use "{" and "}" my UrlConnection returns an error for bad URL.

I use this to instantiate my NSString :

NSString *myURL = [NSString stringWithFormat:@"http://somesite.com/Servlet?PARAM={(%@)}"];

How can I code those char in my NSString ?

Thanks in advance !

© Stack Overflow or respective owner

Related posts about iphone

Related posts about encoding